package com.cos.openapi.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @author: COS
 * @time: 2021/2/1 9:01
 * @description: layui表格数据展示要求的数据类型
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TableResult<T> {
    private Integer code = 0;
    private String msg;
    private Long count = 0L;
    private List<T> data;

    /**
     *
     * @author: COS
     * @return:
     * @time: 2021/2/1 9:05
     * @description: 返回tableResult对象
     */
    public static <T> TableResult getResultBySuccess(Long count,List<T> data){
        return new TableResult(0,null,count,data);
    }
    /**
     *
     * @author: COS
     * @return:
     * @time: 2021/2/1 9:05
     * @description: 返回tableResult对象
     */
    public static TableResult getResultByFail(String msg){
        return new TableResult(1,msg,0L,null);
    }
}
